﻿package mortal.game.view.business
{
    import com.mui.controls.*;
    import com.mui.display.*;
    import mortal.game.resource.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;

    public class TradeListRenderer extends GCellRenderer
    {
        protected var _item:BaseItem;
        protected var _bg:ScaleBitmap;
        protected var _txtName:GTextFiled;

        public function TradeListRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.bg(2, 2, 140, 48, this, ImagesConst.InputDisablBg);
            this._item = UIFactory.getUICompoment(BaseItem, 6, 5, this);
            this._item.setItemStyle(ItemStyleConst.Small, ImagesConst.PackItemBg, 2, 2);
            this._item.isDragAble = false;
            this._txtName = UIFactory.gTextField("", 50, 18, 92, 20, this);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose(param1);
            this._item.dispose(param1);
            this._txtName.dispose(param1);
            this._bg = null;
            this._item = null;
            this._txtName = null;
            return;
        }// end function

        override public function get data() : Object
        {
            return super.data;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:TradeItemVo = null;
            super.data = param1;
            if (param1 is TradeItemVo)
            {
                _loc_2 = param1 as TradeItemVo;
                this._item.itemData = _loc_2.itemData;
                this._item.amount = _loc_2.amount;
                this._txtName.htmlText = ItemsUtil.getItemName(_loc_2.itemData);
            }
            else
            {
                this._item.itemData = null;
                this._txtName.htmlText = "";
            }
            return;
        }// end function

    }
}
